package de.koller.worlders.gameplay.ability;

import de.koller.worlders.WSea;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class PlayerAbilityRoot extends WSea implements Iterable<Ability> {

	private final List<Ability> abilitys = new ArrayList<>();
	
	public void addAbility( Ability a ) {
		abilitys.add( a );
		this.addChild( a );
	}
	
	public void removeAbility( Ability a ) {
		abilitys.remove( a );
		a.removeMe();
	}

	public Ability getAbility( int i ) {
		try {
			return abilitys.get( i );
		} catch( IndexOutOfBoundsException ex ) {
			return null;
		}
		
	}
	@Override
	public Iterator<Ability> iterator() {
		return abilitys.iterator();
	}
	
	
}
